#include "XXborder.h"
#include <QVBoxLayout>

XXborder::XXborder(QWidget *parent)
    : QFrame(parent){
    setAttribute(Qt::WA_StyledBackground);
    setAttribute(Qt::WA_TranslucentBackground);
    setWindowFlag(Qt::FramelessWindowHint);

    QVBoxLayout *mLayout = new QVBoxLayout(this);
    mLayout->setMargin(0);
    this->setLayout(mLayout);

    _background = new QFrame(this);
    _background->setObjectName("_backgroundView");
    mLayout->addWidget(_background);
    QVBoxLayout *bLayout = new QVBoxLayout(_background);
    bLayout->setMargin(0);
    bLayout->setSpacing(0);
    _background->setLayout(bLayout);

    _titleBar = new XXtitleBar(this);
    bLayout->insertWidget(0,_titleBar,0,Qt::AlignTop);
}
XXborder::~XXborder(){}

void XXborder::setContent(QWidget *widget){
    QBoxLayout *boxLayout = qobject_cast<QBoxLayout*>(_background->layout());
    boxLayout->insertWidget(1,widget,2);
}
